<template>
  <div class="template-wrap">
    <menu-top></menu-top>
    <div class="content">
      <div class="content-wrap">
        <div>
          <menu-left ref="left" :href="href"></menu-left>
        </div>
        <el-col>
          <div class="company-edit-wrap right-content">
            <el-breadcrumb v-if="!id" separator-class="el-icon-arrow-right">
              <el-breadcrumb-item :to="{ path: '/companyEdit' }">我的公司</el-breadcrumb-item>
              <el-breadcrumb-item>基础信息</el-breadcrumb-item>
            </el-breadcrumb>
            <el-breadcrumb v-if="id" separator-class="el-icon-arrow-right">
              <el-breadcrumb-item :to="{ path: '/bankBankOrderHand' }">我的订单</el-breadcrumb-item>
              <el-breadcrumb-item>基础信息</el-breadcrumb-item>
            </el-breadcrumb>
            
            <div class="wrap">
              <rotate-message></rotate-message>
              <div class="wrap-container">
                <div class="title">
                    公司状态：<span>{{statusArr[info.coreData.auditStatus]}}</span>
                    <!-- <span v-if="info.coreData&&info.coreData.auditStatus == 'pass'">{{info.coreData&&info.coreData.companyBase&&info.coreData.companyBase.canFinancing=='y'?'初审认证通过':'初审认证不通过'}}</span>
                    <span v-if="info.coreData&&info.coreData.auditStatus != 'pass'">{{info.coreData.auditStatus=='init'?'待审核':'已审核'}}</span> -->
                </div>
                <div class="info-edit">
                     <el-form :model="information" :rules="rules" ref="information" >
                        <div class="edit-title">基础信息<div v-if="editState&&!id" @click="()=>{this.editState = false}" class="btn">编辑</div></div>
                        <el-form-item prop="lastYearIncome">
                            <div class="edit-list ">
                                <div class="name">企业名称：</div>
                                <div class="edit-value text">{{info.coreData&&info.coreData.companyName}}</div>
                            </div>
                        </el-form-item>
                        <el-form-item prop="secondIndustry">
                            <div class="edit-list address">
                                <div class="name">所属行业：</div>
                                <div  v-if="!editState" class="edit-value">
                                    <el-select v-model="information.firstIndustry" @change="firstChange" clearable placeholder="请选择">
                                        <el-option
                                        v-for="item in industryArr"
                                        :key="item.key"
                                        :label="item.value"
                                        :value="item.key">
                                        </el-option>
                                    </el-select>
                                    <el-select v-model="information.secondIndustry" @change="secondChange"  clearable placeholder="请选择">
                                    <el-option
                                        v-for="item in secondArr"
                                        :key="item.key"
                                        :label="item.value"
                                        :value="item.key">
                                        </el-option>
                                    </el-select>
                                    <el-select v-model="information.thirdIndustry" clearable placeholder="请选择">
                                        <el-option
                                        v-for="item in thirdArr"
                                        :key="item.key"
                                        :label="item.value"
                                        :value="item.key">
                                        </el-option>
                                    </el-select>
                                </div>
                                <div v-if="editState" class="name-value" >{{info.coreData&&info.coreData.firstIndustryDesc?info.coreData.firstIndustryDesc:'/'}}{{info.coreData&&info.coreData.secondIndustryDesc?'-'+info.coreData.secondIndustryDesc:'/'}}{{info.coreData&&info.coreData.thirdIndustryDesc?'-'+info.coreData.thirdIndustryDesc:'/'}}</div>
                            </div>
                        </el-form-item>
                        <el-form-item prop="regdate">
                            <div class="edit-list">
                                <div class="name">注册成立日期：</div>
                                <div  v-if="!editState" class="edit-value input">
                                    <el-date-picker
                                        v-model="information.regdate"
                                        type="date"
                                        placeholder="选择日期"
                                        format="yyyy 年 MM 月 dd 日"
                                        value-format="yyyy-MM-dd">
                                    </el-date-picker>
                                </div>
                                <div v-if="editState" class="name-value" >{{info.coreData&&info.coreData.regdate?info.coreData.regdate.split(' ')[0]:'/'}}</div>
                            </div>
                        </el-form-item>
                        <!-- <el-form-item prop="regDistrictCode">
                            <div class="edit-list address">
                                <div class="name">注册所在地：</div>
                                <div  v-if="!editState" class="edit-value">
                                    <el-select v-model="information.regProvinceCode"  @change="provinceChange" clearable placeholder="请选择">
                                        <el-option
                                        v-for="item in addressArr"
                                        :key="item.key"
                                        :label="item.value"
                                        :value="item.key">
                                        </el-option>
                                    </el-select>
                                    <el-select v-model="information.regCityCode" @change="cityChange" clearable placeholder="请选择">
                                    <el-option
                                        v-for="item in cityArr"
                                        :key="item.key"
                                        :label="item.value"
                                        :value="item.key">
                                        </el-option>
                                    </el-select>
                                    <el-select v-model="information.regDistrictCode" clearable placeholder="请选择">
                                        <el-option
                                        v-for="item in districtArr"
                                        :key="item.key"
                                        :label="item.value"
                                        :value="item.key">
                                        </el-option>
                                    </el-select>
                                </div>
                                <div v-if="editState" class="name-value" >{{info.coreData&&info.coreData.regProvinceName?info.coreData.regProvinceName:'/'}}{{info.coreData&&info.coreData.regCityName?'-'+info.coreData.regCityName:'/'}}{{info.coreData&&info.coreData.regDistrictName?'-'+info.coreData.regDistrictName:'/'}}</div>
                            </div>
                        </el-form-item> -->
                        <div class="edit-title">营业执照信息</div>
                        <el-form-item class="lince-image" prop="licenceId">
                            <div class="edit-list image">
                                <div class="name">营业执照复印件：</div>
                                <div v-if="!editState" class="edit-value">
                                    <div class="add-image">
                                        <el-upload  list-type="picture-card" class="normal-uploader" 
                                            :class="{uploadShow:uploadShow}"
                                            :action="upLoadUrl"    
                                            :on-success="handleFileSuccess"   
                                            :file-list='fileShowList'
                                            :limit='10'
                                            :on-remove="handleRemove">   
                                            <i class="el-icon-plus"></i> 
                                        </el-upload>  
                                    </div>
                                </div>
                                <div  v-if="editState" class="edit-img">
                                    <img :src="info.licenceData&&info.licenceData.licenceFileInfo?info.licenceData.licenceFileInfo.fileUrl:''" alt="">
                                </div>
                            </div>
                        </el-form-item>
                        <el-form-item prop="unifiedCreditNumber">
                            <div class="edit-list">
                                <div class="name">社会统一信用号：</div>
                                <div v-if="!editState" class="edit-value input">
                                    <el-input v-model="information.unifiedCreditNumber" placeholder="请输入内容"></el-input>
                                </div>
                                 <div v-if="editState" class="name-value" >{{info.licenceData&&info.licenceData.unifiedCreditNumber?info.licenceData.unifiedCreditNumber:'/'}}</div>
                            </div>
                        </el-form-item>
                        <el-form-item prop="legalCardId">
                            <div class="edit-list">
                                <div class="name">法定代表人：</div>
                                <div v-if="!editState" class="edit-value input">
                                    <el-input v-model="information.legalCardId" placeholder="请输入内容"></el-input>
                                </div>
                                <div v-if="editState" class="name-value" >{{info.licenceData&&info.licenceData.legalCardId?info.licenceData.legalCardId:''}}</div>
                            </div>
                        </el-form-item>
                        <el-form-item prop="actualCardId">
                            <div class="edit-list">
                                <div class="name">实际控制人：</div>
                                <div v-if="!editState" class="edit-value input">
                                    <el-input v-model="information.actualCardId" placeholder="请输入内容"></el-input>
                                </div>
                                <div v-if="editState" class="name-value" >{{info.licenceData&&info.licenceData.actualCardId?info.licenceData.actualCardId:''}}</div>
                            </div>
                        </el-form-item>
                        <el-form-item prop="regDistrictCode1">
                           <div class="edit-list register">
                                <div class="name">注册地址：</div>
                                <div v-if="!editState" class="edit-value">
                                    <el-select v-model="information.regProvinceCode1"  @change="provinceChange1" clearable placeholder="请选择">
                                        <el-option
                                        v-for="item in addressArr"
                                        :key="item.key"
                                        :label="item.value"
                                        :value="item.key">
                                        </el-option>
                                    </el-select>
                                    <el-select v-model="information.regCityCode1" @change="cityChange1" clearable placeholder="请选择">
                                    <el-option
                                        v-for="item in cityArr1"
                                        :key="item.key"
                                        :label="item.value"
                                        :value="item.key">
                                        </el-option>
                                    </el-select>
                                    <el-select v-model="information.regDistrictCode1" clearable placeholder="请选择">
                                        <el-option
                                        v-for="item in districtArr1"
                                        :key="item.key"
                                        :label="item.value"
                                        :value="item.key">
                                        </el-option>
                                    </el-select>
                                    <el-input class="address-input" v-model="information.regAddress" placeholder="请输入内容"></el-input>
                                </div>
                                <div v-if="editState" class="name-value" >{{info.licenceData&&info.licenceData.regProvinceName?info.licenceData.regProvinceName:'/'}}{{info.licenceData&&info.licenceData.regCityName?'-'+info.licenceData.regCityName:'/'}}{{info.licenceData&&info.licenceData.regDistrictName?'-'+info.licenceData.regDistrictName:'/'}}{{info.licenceData&&info.licenceData.regAddress?'-'+info.licenceData.regAddress:'/'}}</div>
                            </div> 
                        </el-form-item>
                        <el-form-item prop="runRegDistrictCode">
                            <div class="edit-list register">
                                <div class="name">经营地址：</div>
                                <div v-if="!editState" class="edit-value">
                                    <el-select v-model="information.runProvinceCode"  @change="provinceChange2" clearable placeholder="请选择">
                                        <el-option
                                        v-for="item in addressArr"
                                        :key="item.key"
                                        :label="item.value"
                                        :value="item.key">
                                        </el-option>
                                    </el-select>
                                    <el-select v-model="information.runRegCityCode" @change="cityChange2" clearable placeholder="请选择">
                                    <el-option
                                        v-for="item in cityArr2"
                                        :key="item.key"
                                        :label="item.value"
                                        :value="item.key">
                                        </el-option>
                                    </el-select>
                                    <el-select v-model="information.runRegDistrictCode" clearable placeholder="请选择">
                                        <el-option
                                            v-for="item in districtArr2"
                                            :key="item.key"
                                            :label="item.value"
                                            :value="item.key">
                                        </el-option>
                                    </el-select>
                                    <el-input class="address-input" v-model="information.runRegAddress" placeholder="请输入内容"></el-input>
                                </div>
                                <div v-if="editState" class="name-value" >{{info.licenceData&&info.licenceData.runProvinceName?info.licenceData.runProvinceName:'/'}}{{info.licenceData&&info.licenceData.runRegCityName?'-'+info.licenceData.runRegCityName:'/'}}{{info.licenceData&&info.licenceData.runRegDistrictName?'-'+info.licenceData.runRegDistrictName:'/'}}{{info.licenceData&&info.licenceData.runRegAddress?'-'+info.licenceData.runRegAddress:'/'}}</div>
                            </div> 
                        </el-form-item>
                        <el-form-item prop="companyPeople">
                            <div class="edit-list">
                                <div class="name">企业员工人数：</div>
                                <div v-if="!editState" class="edit-value input">
                                    <el-input v-model="information.companyPeople" placeholder="请输入内容"></el-input>
                                </div>
                                <div v-if="editState" class="name-value" >{{info.licenceData&&info.licenceData.companyPeople?info.licenceData.companyPeople:'/'}}</div>
                            </div>  
                        </el-form-item>   
                        <el-form-item prop="contactDatas">
                            <div class="edit-list introduce">
                                <div class="name">高层管理人员说明:</div>
                                <div v-if="!editState" class="edit-value">
                                    <div class="title-item">
                                        <div class="title-list">姓名</div>
                                        <div class="title-list">年龄</div>
                                        <div class="title-list">职业</div>
                                        <div class="title-list">简历介绍</div>
                                    </div>
                                    <div class="edit-list" v-for="(item,index) in information.contactDatas" :key="index">
                                        <el-input v-model="item.trueName" placeholder="请输入"></el-input>
                                        <el-input v-model="item.age" placeholder="请输入"></el-input>
                                        <el-select v-model="item.position" clearable placeholder="请选择">
                                            <el-option
                                            v-for="item in positionArr"
                                            :key="item.key"
                                            :label="item.value"
                                            :value="item.key">
                                            </el-option>
                                        </el-select>
                                        <el-input class="address-input" v-model="item.introduction" placeholder="请输入内容"></el-input>
                                        <!-- <div @click="addBtn" class="btn-add">删除</div> -->
                                        <i class="el-icon-delete delete-input" @click="deleteInput(index)" v-if="index!=information.contactDatas.length-1"></i>
                                        <i @click="addBtn" class="btn-add" v-if="index==information.contactDatas.length-1">添加</i>
                                  </div>
                                    
                                </div>
                                 <el-table
                                        v-if="editState"
                                        :data="info.licenceData ? info.licenceData.contactDatas : []"
                                        stripe
                                        style="width: 85%"
                                        border>
                                        <el-table-column
                                        prop="trueName"
                                        label="姓名"
                                        >
                                        </el-table-column>
                                        <el-table-column
                                        prop="age"
                                        label="年龄"
                                        >
                                        </el-table-column>
                                        <el-table-column
                                        prop="positionDesc"
                                        label="职业">
                                        </el-table-column>
                                        <el-table-column
                                        prop="introduction"
                                        min-width="250px"
                                        label="简历介绍">
                                        </el-table-column>
                                    </el-table>
                            </div> 
                        </el-form-item>  
                        <el-form-item prop="parentChannelCode">
                            <div class="edit-list chanel">
                                <div class="name">所属推荐机构：</div>
                                <div v-if="!editState" class="edit-value">
                                    <el-select v-model="information.parentChannelCode" clearable placeholder="请选择">
                                        <el-option
                                        v-for="item in channelArr"
                                        :key="item.channelCode"
                                        :label="item.companyName"
                                        :value="item.channelCode">
                                        </el-option>
                                    </el-select>
                                </div>
                                 <div v-if="editState" class="name-value" >{{info.baseData&&info.baseData.parentChannelName?info.baseData.parentChannelName:'/'}}</div>
                            </div>     
                        </el-form-item> 
                     </el-form>     
                </div>
                <div v-if="!editState" @click="submitBtn('information')" class="btn-submit">提交</div>
              </div>
            </div>
          </div>
        </el-col>
      </div>
    </div>
  </div>
</template>

<script>
let CONSTANT = require('../../../constant/constant.js'),
    common = require('../../../common.js');
import VueRouter from 'vue-router'
export default {
  name: 'menulist',
  data(){
    var validateCard =  (rule, value, callback) => {
       var reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/; 
        if (!reg.test(value)){ return callback(new Error('证件输入不合法')); }
        callback();
    };
    var validateCode =  (rule, value, callback) => {
        if (!common.checkSocialCreditCode(value)) return callback(new Error('社会统一信用号输入不合法'))
        return callback();
    };
    var validateNum =  (rule, value, callback) => { 
        if (isNaN(value)){ return callback(new Error('请输入数字')); }
        var reg= /^(-?\d+)(\.\d{1,2})?$/
        if (!reg.test(value)){ return callback(new Error('请保留两位小数')); }
        callback();
    };
    return{
      href:'',
      state:'',
      info: { coreData: {} } ,
      industryArr:[],
      secondArr:[],
      thirdArr:[],
      positionArr:[],
      fileShowList:[],
      editState:true,
      id:'',
      information:{
          parentChannelCode:'',
          firstIndustry:'',
          secondIndustry:'',
          thirdIndustry:'',
          regdate:'',
          regProvinceCode :'',
          regCityCode:'',
        //   regDistrictCode:"",
          unifiedCreditNumber :'',
          legalCardId :'',
          actualCardId:'',
          licenceId:'',
          regProvinceCode1:'',
          regCityCode1:'',
          regDistrictCode1:"",
          regAddress:'',
          runProvinceCode:'',
          runRegCityCode:'',
          runRegDistrictCode:'',
          runRegAddress:'',
          companyPeople:'',
          contactDatas:[{
              age:'',
              position:'',
              trueName:'',
              introduction:''
          }]
      },
      rules:{
        //   secondIndustry: [
        //     { required: true, message: '请选择所属行业', trigger: 'blur' }
        //   ],
        //   regdate: [
        //     { required: true, message: '请选择注册成立日期', trigger: 'blur' }
        //   ],
        // //   regDistrictCode: [
        // //     { required: true, message: '请选择注册所在地', trigger: 'blur' }
        // //   ],
        //   licenceFileId: [
        //     { required: true, message: '请上传营业执照复印件', trigger: 'blur' }
        //   ],
        //   unifiedCreditNumber: [
        //     { required: true, message: '请输入社会统一信用号', trigger: 'blur' },
        //     {  validator: validateCode, trigger: 'blur' }
        //   ],
        //   legalCardId: [
        //     { required: true, message: '请输入法定代表人', trigger: 'blur' },
        //   ],
        //   actualCardId: [
        //     { required: true, message: '请输入实际控制人', trigger: 'blur' },
        //   ],
        //   regDistrictCode1: [
        //     { required: true, message: '请选择注册地址', trigger: 'blur' }
        //   ],
        //   runRegDistrictCode: [
        //     { required: true, message: '请选择经营地址', trigger: 'blur' }
        //   ],
        //   companyPeople: [
        //     { required: true, message: '请输入企业员工人数', trigger: 'blur' },
        //     {  validator: validateNum, trigger: 'blur' }
        //   ],
        //  licenceId: [
        //     { required: true, message: '请上传营业执照复印件', trigger: 'blur' }
        //  ],
        //   contactDatas: [
        //     { required: true, message: '高层管理人员说明不能为空', trigger: 'blur' }
        //   ],
      },
      uploadShow:false,
      upLoadUrl:'',
      addressArr:[],
      cityArr:[],
      districtArr:[],
      cityArr1:[],
      districtArr1:[],
      cityArr2:[],
      districtArr2:[],
      channelArr:[],
      statusArr:{
          'init':'审核中',
          'pass':'通过审核',
          'reject':'没通过审核',
      }
    }
  },
  components: {
    'menu-top':() => import('../../common/Menu-Top'),
    'menu-left':() => import('../../common/Menu-Left'),
    "rotate-message": () => import("../../common/rotate-message")
  },  
  created(){
      this.id = this.$router.currentRoute.query.id;
  },
  mounted(){
        let sessionId = common.getCookie('sessionId');
        this.state = common.getCookie('userType')
        this.upLoadUrl =CONSTANT.URL.BASE.ADMINUPLOAD+ '?sessionId='+sessionId;
        this.getDetail()
        this.getChannel()   
        setTimeout(()=>{
            this.getIndustry()
            this.getProvince()
            this.getPosition()
            
        },100)
  },    
  watch: {  
      $route(to, from) {  
        // this.$refs.left.activePath()
      },
      'industryArr':function(){
          this.industryArr.map((item)=>{
                if(this.information.firstIndustry == item.key){
                    this.secondArr = item.childs
                    item.childs.map((list)=>{
                        if(this.information.secondIndustry == list.key){
                            this.thirdArr = list.childs
                        }
                    })
                }
            })
      },
      'addressArr':function(){
          this.addressArr.map((item)=>{
                if(this.information.regProvinceCode == item.key){
                    this.cityArr = item.childs
                    item.childs.map((list)=>{
                        if(this.information.regCityCode == list.key){
                            this.districtArr = list.childs
                        }
                    })
                }
                if(this.information.regProvinceCode1 == item.key){
                    this.cityArr1 = item.childs
                    item.childs.map((list)=>{
                        if(this.information.regCityCode1 == list.key){
                            this.districtArr1 = list.childs
                        }
                    })
                }
                if(this.information.runProvinceCode == item.key){
                    this.cityArr2 = item.childs
                    item.childs.map((list)=>{
                        if(this.information.runRegCityCode == list.key){
                            this.districtArr2 = list.childs
                        }
                    })
                }
            })
      },
  },

  methods:{
      addBtn(){
          this.information.contactDatas.push({
              age:'',
              position:'',
              trueName:'',
              introduction:''  
          })
      },
      getDetail(){
          let api;
            if(this.id){
                api = CONSTANT.URL.CHANNEL.FINDUSERBASEDETAIL
            }else{
                api = CONSTANT.URL.WEB.FINDUSERBASEDETAILBYID
            }
            let  url = api,
                data = {},
                dataForm = {userId:this.id?this.id:null}
                common.requestAjax(url,JSON.stringify(data),dataForm,(res)=>{
                if(res.status == 200){
                    this.info= res.data.bussData;
                    let data = res.data.bussData;
                    // if()
                    this.information = {
                        firstIndustry:data.coreData.firstIndustry,
                        secondIndustry:data.coreData.secondIndustry,
                        thirdIndustry:data.coreData.thirdIndustry,
                        regdate:data.coreData.regdate,
                        regProvinceCode :data.coreData.regProvinceCode,
                        regCityCode:data.coreData.regCityCode,
                        // regDistrictCode:data.coreData.regDistrictCode,
                        unifiedCreditNumber:data.licenceData?data.licenceData.unifiedCreditNumber:'',
                        legalCardId:data.licenceData?data.licenceData.legalCardId:'',
                        actualCardId:data.licenceData?data.licenceData.actualCardId:'',
                        regProvinceCode1:data.licenceData?data.licenceData.regProvinceCode:'',
                        regCityCode1:data.licenceData?data.licenceData.regCityCode:'',
                        regDistrictCode1:data.licenceData?data.licenceData.regDistrictCode:'',
                        regAddress:data.licenceData?data.licenceData.regAddress:'',
                        companyPeople:data.licenceData?data.licenceData.companyPeople:'',
                        contactDatas:data.licenceData&&data.licenceData.contactDatas.length?data.licenceData.contactDatas:this.information.contactDatas,
                        parentChannelCode:data.baseData.parentChannelCode?data.baseData.parentChannelCode:[],
                        runProvinceCode:data.licenceData?data.licenceData.runProvinceCode:'',
                        runRegCityCode:data.licenceData?data.licenceData.runRegCityCode:'',
                        runRegDistrictCode:data.licenceData?data.licenceData.runRegDistrictCode:'',
                        runRegAddress:data.licenceData?data.licenceData.runRegAddress:'',
                        licenceId:data.licenceData?data.licenceData.licenceFileId:''
                    }
                    data.licenceData && this.fileShowList.push({
                        url:data.licenceData.licenceFileInfo.fileUrl
                    })
                }else{
                
                }
            })
        },
        submitBtn(formName) {
            this.$refs[formName].validate((valid) => {
            if (valid) {
                if(this.information.contactDatas&&this.information.contactDatas.length){
                    let arr = []
                    this.information.contactDatas.forEach((item)=>{
                        arr.push({
                             trueName:item.trueName,
                             age:item.age,
                             position:item.position,
                             introduction:item.introduction
                        })
                    })
                    this.information.contactDatas = arr;
                }else{
                    this.information.contactDatas = []
                }
               let  url = CONSTANT.URL.SYSTEM.SAVEUSERBASEDETAIL,
                data = {
                    "baseData": {
                        "parentChannelCode":this.information.parentChannelCode,
                        "userId": this.info.baseData.userId
                    },
                    "coreData": {
                        "firstIndustry":this.information.firstIndustry,
                        "regAddress": null,
                        "regCityCode": this.information.regCityCode1,
                        "regDistrictCode": this.information.regDistrictCode1,
                        "regProvinceCode": this.information.regProvinceCode1,
                        "regdate": this.information.regdate,
                        "secondIndustry":  this.information.secondIndustry,
                        "thirdIndustry": this.information.thirdIndustry,
                        "userId": this.info.baseData.userId
                    },
                    "licenceData": {
                        "actualCardId":this.information.actualCardId,
                        "companyPeople":this.information.companyPeople,
                        "contactDatas": this.information.contactDatas,
                        "legalCardId": this.information.legalCardId,
                        "regAddress": this.information.regAddress,
                        "regCityCode": this.information.regCityCode1,
                        "regDistrictCode": this.information.regDistrictCode1,
                        "regProvinceCode": this.information.regProvinceCode1,
                        "runProvinceCode":  this.information.runProvinceCode,
                        "runRegAddress": this.information.runRegAddress,
                        "runRegCityCode":  this.information.runRegCityCode,
                        "runRegDistrictCode":  this.information.runRegDistrictCode,
                        "unifiedCreditNumber":  this.information.unifiedCreditNumber,
                        "userId": this.info.baseData.userId,
                        'licenceFileId':this.information.licenceId
                    },
                    "userId": this.info.baseData.userId,
                    "parentChannelCode":this.information.parentChannelCode
                },
                dataForm = {}
                common.requestAjax(url,JSON.stringify(data),dataForm,(res)=>{
                if(res.status == 200){
                    this.$message({
                        message: '保存成功！',
                        type: 'success'
                    });
                    this.getDetail()
                    this.editState = true;
                }else{
                    this.$message.error(res.msg);
                }
            })
            } else {
                return false;
            }
            });
        },
        getProvince(){
            let  url = CONSTANT.URL.BASE.DICTIONARY,
                data = {},
                dataForm = {codeType:'province'}
                common.requestAjax(url,JSON.stringify(data),dataForm,(res)=>{
                if(res.status == 200){
                    this.addressArr= res.data.bussData
                    localStorage.setItem("address",JSON.stringify( res.data.bussData));
                }else{
                
                }
            })
        },
        provinceChange(e){
            this.information.regCityCode = ''
            this.cityArr = [];
            this.districtArr = []
            this.information.regDistrictCode = ''
            this.addressArr.map((item)=>{
                if(e== item.key){
                    this.cityArr = item.childs
                }
            })
        },
        cityChange(e){
            this.districtArr = []
            this.information.regDistrictCode = ''
            this.cityArr.map((item)=>{
                if(e == item.key){
                    this.districtArr = item.childs
                }
            })
        },
        provinceChange1(e){
            this.information.regCityCode1 = ''
            this.cityArr1 = [];
            this.districtArr1 = []
            this.information.regDistrictCode1 = ''
            this.addressArr.map((item)=>{
                if(e== item.key){
                    this.cityArr1 = item.childs
                }
            })
        },
        cityChange1(e){
            this.districtArr1 = []
            this.information.regDistrictCode1 = ''
            this.cityArr1.map((item)=>{
                if(e == item.key){
                    this.districtArr1 = item.childs
                }
            })
        },
        deleteInput(index){
            this.information.contactDatas.splice(index,1)
        },
        provinceChange2(e){
            this.information.regCityCode2 = ''
            this.cityArr2 = [];
            this.districtArr2 = []
            this.information.regDistrictCode2 = ''
            this.addressArr.map((item)=>{
                if(e== item.key){
                    this.cityArr2 = item.childs
                }
            })
        },
        cityChange2(e){
            this.districtArr2 = []
            this.information.regDistrictCode2 = ''
            this.cityArr2.map((item)=>{
                if(e == item.key){
                    this.districtArr2 = item.childs
                }
            })
        },
        firstChange(e){
            this.information.secondIndustry = ''
            this.thirdArr = [];
            this.secondArr = []
            this.information.thirdIndustry = ''
            this.industryArr.map((item)=>{
                if(e== item.key){
                    this.secondArr = item.childs
                }
            })
        },
        secondChange(e){
            this.thirdArr = []
            this.information.thirdIndustry = ''
            this.secondArr.map((item)=>{
                if(e == item.key){
                    this.thirdArr = item.childs
                }
            })
        },
        getIndustry(){
            let  url = CONSTANT.URL.BASE.DICTIONARY,
                data = {},
                dataForm = {codeType:'first_industry'}
                common.requestAjax(url,JSON.stringify(data),dataForm,(res)=>{
                if(res.status == 200){
                    this.industryArr= res.data.bussData
                }else{
                
                }
            })
        },
        getChannel(){
            let  url = CONSTANT.URL.SYSTEM.FINDCHANNELUSER,
                data = {},
                dataForm = {}
                common.requestAjax(url,JSON.stringify(data),dataForm,(res)=>{
                if(res.status == 200){
                    this.channelArr= res.data.bussData
                }else{
                
                }
            })
        },
        getPosition(){
            let  url = CONSTANT.URL.BASE.DICTIONARY,
                data = {},
                dataForm = {codeType:'position'}
                common.requestAjax(url,JSON.stringify(data),dataForm,(res)=>{
                if(res.status == 200){
                    this.positionArr= res.data.bussData
                }else{
                
                }
            })
        },
        handleRemove(file, fileList) {      // 图片上传
            let deleteUrl = file.url;
            this.uploadShow = false;
            this.information.licenceId = '';
            this.information.licenceFileId = '';
        },       
        handleFileSuccess(res, file) {
            if(res.status == 200){
                let picItem = res.data.bussData;
                this.information.licenceId = picItem.fileId;
                this.uploadShow = true;
            }
        },
  }
}
</script>

<style  lang="scss">

body{
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Avenir', Helvetica, Arial, sans-serif;
}
.uploadShow  .el-upload{display: none;}
.content{
  min-height: 100%;
  background-color: #f5f5f5;
  width: 81.3%;
  float: right;
}

.content-wrap{
  overflow: hidden;
}

.company-edit-wrap{
  padding-top: 29px;
  .el-input__inner{
      padding-left: 13px;
  }
  .wrap{
    background-color: #f5f5f5;
    .el-input__inner{
        border:1px solid #e1e1e1;
    }
    .title-head{
      height: 50px;
      line-height: 50px;
      background-color: #fff;
      margin-top: 18px;
      padding-left: 20px;
      font-size: 14px;
      color: #666;
      span{
        color: #0087DC;
        cursor: pointer;
      }
    }
    .wrap-container{
      padding: 11px 60px 33px 29px;
      background-color: #fff;
      margin-top: 20px;
      .title{
        height: 56px;
        line-height: 56px;
        border-bottom: 1px solid #D1D1D1;
        color: #666;
        font-size: 16px;
        span{
            color: #111;
            // font-weight: bold;
        }
      }
      .el-form-item{
          margin-bottom: 0;
          .el-form-item__content{
              line-height: inherit;
          }
      }
      .btn-submit{
            margin: 50px 0 0 30%;
            width: 200px;
            height: 40px;
            border-radius: 4px;
            -webkit-border-radius: 4px;
            background-color: #ED7018;
            font-size: 24px;
            color: #fff;
            text-align: center;
            line-height: 40px;
            cursor: pointer;
            &:hover{
                background-color: #ED9000;
                transition:all .2s linear
            }
        }
      .info-edit{
          padding-top: 31px;
          .edit-title{
              position: relative;
              font-size: 16px;
              color: #333;
            //   font-weight: bold;
              padding-left: 16px;
              margin-bottom: 28px;
              .btn{
                    position: absolute;
                    right: 30px;
                    top: 0px;
                    width: 73px;
                    height: 40px;
                    margin-left: 41px;
                    background-color: #ED7018;
                    border-radius: 4px;
                    -webkit-border-radius: 4px;
                    font-size: 14px;
                    color: #fff;
                    text-align: center;
                    line-height: 40px;
                    cursor: pointer;
                    &:hover{
                        background-color: #ED9000;
                        transition:all .2s linear
                    } 
                }
            //   &:after{
            //       content: '';
            //       position: absolute;
            //       left: 0;
            //       top: 2px;
            //       width: 3px;
            //       height: 17px;
            //       background-color: #ED7018;
            //   }
          }
          .name-value{
            height: 40px;
            line-height: 40px;
          }
          .el-form-item__error{
            top: 64%;
            left: 11%;
          }
          .lince-image{
            .el-form-item__error{
                top: 93%;
            }
          }
          .edit-list{
              overflow: hidden;
              margin-bottom: 24px;
              .name{
                  float: left;
                  width: 10%;
                  text-align: right;
                  font-size: 14px;
                  color: #666;
                  margin-right: 15px;
                  height: 40px;
                  line-height: 40px;
                  min-width: 120px;
              }
              .delete-input{
                  font-size: 20px;
                  cursor: pointer;
                  color: #ED7018;
                 &:hover{
                    color: #ED9000;
                    transition:all .2s linear
                } 
              }
              &.line{
                .el-select{
                  margin-right: 10px;
                  width: 185px;
                  margin-right: 10px;
                }
              }
              &.image{
                 .edit-value{
                     float: none;
                     .add-image{
                         margin-left: 120px;
                         margin-top: 50px;
                     }
                 } 
              }
              &.address{
                .el-select{
                  margin-right: 16px;
                  width: 115px;
                }
              }
              &.chanel{
                 .el-select{
                  width: 384px;
                } 
              }
              &.register{
                .el-select{
                  margin-right: 10px;
                  width: 87px;
                }
                .address-input{
                    width: 422px;
                }
              }
              .edit-img{
                    
                    img{
                        width: 306px;
                        height: 227px;
                        border: 0;
                    }
                }
              &.introduce{
                  margin-bottom: 0;
                  .title-item{
                      overflow: hidden;
                      font-size: 14px;
                      color: #666;
                      height: 40px;
                      line-height: 40px;
                      .title-list{
                          float: left;
                          width: 87px;
                          margin-right: 10px;
                      }
                  }
                .el-input{
                    margin-right: 10px;
                    width: 87px;
                }
                .address-input{
                    display: inline-block;
                }
                .address-input{
                    width: 422px;
                   
                }
              }
              .edit-value{
                  position: relative;
                  float: left;
                  font-size: 14px;
                  color: #333;
                  .el-icon-plus{
                    width: 306px;
                    height: 227px;
                    background: url(../../../images/photo.png);
                    background-size: 100%;
                    &:before{
                        content: ''
                    }
                  }
                  .btn-add{
                        // position: absolute;
                        // right: -100px;
                        display: inline-block;
                        width: 73px;
                        height: 40px;
                        bottom: 25px;
                        // margin-left: 41px;
                        // margin-top: 30px;
                        background-color: #ED7018;
                        border-radius: 4px;
                        -webkit-border-radius: 4px;
                        font-size: 14px;
                        color: #fff;
                        text-align: center;
                        line-height: 40px;
                        cursor: pointer;
                        &:hover{
                            background-color: #ED9000;
                            transition:all .2s linear
                        } 
                    }
                  .el-upload--picture-card{
                    width: 306px;
                    height: 227px;
                    border: 0;
                  }
                  .el-upload-list__item{
                      width: 306px;
                    height: 227px;
                  }
                 
                  &.text{
                    height: 40px;
                    line-height: 40px;
                  }
                  &.input{
                       width: 384px;
                        .el-date-editor{
                            width: 384px;
                            input{
                                padding-left: 30px;
                            }
                         }
                  }
                  .add-image{
                      width: 306px;
                      height: 227px;
                  }
              }
          }
      }
    }
  }
}

a{
  text-decoration: none;
}
</style>